home *** CD-ROM | disk | FTP | other *** search
/ Champak 132 / (Vol 132) Jun 09 2011.iso / Games / eggs.swf / scripts / frame_2 / DoAction.as
Encoding:
Text File  |  2011-06-09  |  3.9 KB  |  117 lines

  1. stop();
  2. _global.CHighscore = function(sServerName, sGetHighscoreFile, sSaveHighscoreFile)
  3. {
  4.    this.sServerName = sServerName;
  5.    this.sGetHighscoreFile = sGetHighscoreFile;
  6.    this.sSaveHighscoreFile = sSaveHighscoreFile;
  7.    this.aNameOfPlayer = new Array();
  8.    this.aPlayerScore = new Array();
  9.    this.iHighscoreLimit = 0;
  10.    this.bHighscorLoaded = false;
  11.    this.sPlayersNameForHighscore = "";
  12.    this.sPlayersEmailForHighscore = "";
  13.    this.sPlayersScoreForHighscore = "";
  14.    this.HighOfHighscore = 0;
  15. };
  16. CHighscore.prototype.GetHighscoreFromServer = function(mcObj)
  17. {
  18.    var URL = this.sServerName + this.sGetHighscoreFile;
  19.    mcObj.loadVariables(URL,"");
  20.    this.SetOnDataEventHandler(mcObj);
  21. };
  22. CHighscore.prototype.SetOnDataEventHandler = function(mcObj)
  23. {
  24.    mcObj.onData = function()
  25.    {
  26.       if(this.bLoadSucces == "false")
  27.       {
  28.          cGameWorldHighscore.bHighscorLoaded = false;
  29.          this.play();
  30.       }
  31.       else
  32.       {
  33.          cGameWorldHighscore.iHighscoreLimit = this.iLengthOfHighscore;
  34.          var i = 0;
  35.          while(i <= cGameWorldHighscore.iHighscoreLimit)
  36.          {
  37.             cGameWorldHighscore.aNameOfPlayer[i] = eval("this.sPlayerName" + i);
  38.             cGameWorldHighscore.aPlayerScore[i] = eval("this.iPlayerScore" + i);
  39.             i++;
  40.          }
  41.          cGameWorldHighscore.bHighscorLoaded = true;
  42.          this.play();
  43.       }
  44.    };
  45. };
  46. CHighscore.prototype.DisplayHighscore = function(sLinkageObj, iOffsetValueY, iSwapD, mcObj)
  47. {
  48.    if(this.cGameWorldHighscore.bHighscorLoaded == true)
  49.    {
  50.       var iStartX = 0;
  51.       var iStartY = 0;
  52.       var iOffsetY = iOffsetValueY;
  53.       var i = 0;
  54.       while(i < this.cGameWorldHighscore.iHighscoreLimit)
  55.       {
  56.          mcObj.attachMovie("oneLineInHighScore","oneLineInHighScore" + i,i + iSwapD);
  57.          var ObjPath = eval("oneLineInHighScore" + i);
  58.          if(i < 9)
  59.          {
  60.             ObjPath.Rank = "00" + (i + 1);
  61.          }
  62.          else if(i >= 9 && i < 99)
  63.          {
  64.             ObjPath.Rank = "0" + (i + 1);
  65.          }
  66.          else if(i = 99)
  67.          {
  68.             ObjPath.Rank = i + 1;
  69.          }
  70.          ObjPath.nameOfPlayer = this.cGameWorldHighscore.aNameOfPlayer[i];
  71.          ObjPath.Point = this.cGameWorldHighscore.aPlayerScore[i];
  72.          ObjPath._x = iStartX;
  73.          ObjPath._y = iStartY + i * iOffsetY;
  74.          i++;
  75.       }
  76.       this.cGameWorldHighscore.HighOfHighscore = i * iOffsetY;
  77.    }
  78. };
  79. CHighscore.prototype.SaveHighscore = function(mcObj)
  80. {
  81.    if(String(this.sPlayersNameForHighscore).length == 0)
  82.    {
  83.       this.sPlayersNameForHighscore = "n/a";
  84.    }
  85.    if(String(this.sPlayersEmailForHighscore).length == 0)
  86.    {
  87.       this.sPlayersEmailForHighscore = "n/a";
  88.    }
  89.    var URL = this.sServerName + this.sSaveHighscoreFile + "?randomNumOfSite=" + cGameWorld.iRandomNumberOfSite + "&sPlayerName=" + this.sPlayersNameForHighscore + "&sPlayerEmail=" + this.sPlayersEmailForHighscore + "&iPlayerScore=" + this.sPlayersScoreForHighscore;
  90.    mcObj.loadVariables(URL,"");
  91.    mcObj.onData = function()
  92.    {
  93.       this.play();
  94.    };
  95. };
  96. _global.CTellAFriend = function(sServerName, sTellAFriendFile)
  97. {
  98.    this.sServerName = sServerName;
  99.    this.sTellAFriendFile = sTellAFriendFile;
  100.    this.sFromName = "";
  101.    this.sFromEmail = "";
  102.    this.sToName = "";
  103.    this.sToEmail = "";
  104. };
  105. CTellAFriend.prototype.SendAnEmailToAFriend = function(mcObj)
  106. {
  107.    var URL = this.sServerName + this.sTellAFriendFile + "?randomNumOfSite=X65rD99j6Kx&sFromMail=" + this.sFromEmail + "&sFromName=" + this.sFromName + "&sToMail=" + this.sToEmail + "&sToName=" + this.sToName + "&iMyPoint=" + cGameWorld.iGameScore;
  108.    trace(URL);
  109.    mcObj.loadVariables(URL,"");
  110.    mcObj.onData = function()
  111.    {
  112.       this.play();
  113.    };
  114. };
  115. this.cGameWorldHighscore = new CHighscore("","getHighscore.asp","saveHighScoreToDB.asp");
  116. this.cGameWorldTell = new CTellAFriend("","tellAFriend.asp");
  117.